﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using LanzhouBeefNoodles.Models;
using Microsoft.AspNetCore.Mvc;

namespace LanzhouBeefNoodles.controllers
{
    public class FeedbackController : Controller
    {
        private readonly IFeedback _feedback;
        public FeedbackController(IFeedback feedback)
        {
            _feedback = feedback;
        }



        public IActionResult Index()
        {
            return View();
        }
        public IActionResult FeebackComplete()
        {
            return View();
        }

        [HttpPost]
        public IActionResult Index(Feedback feedback)
        {
            if (ModelState.IsValid)  //进行数据验证
            {
                _feedback.AddFeedback(feedback);
                return RedirectToAction("FeebackComplete"); //重定向到评价完成页面
            }
            return View();
        }
    }
}
